<div class="knMasterComments">
	{foreach from=$commentList item=commentItem}
	<div class="knCommentEntry">
		
		{if $loggedIn == true}
			{if $is_admin == true || $commentItem.user==$user->username}
				<!-- delete is only allowed when the user is either admin or the author of the comment -->
				<div class="knCommentDelete" onclick="javascript:deleteComment({$commentItem.id});"></div>
			{/if}
		{/if}
		
		<div class="knCommentAuthorImage">
			<img src="https://graph.facebook.com/{$commentItem.user_extid|substr:3}/picture?type=square" />
		</div>
		<div class="knCommentContent">
			<a target="_blank" href="http://www.facebook.com/{$commentItem.user}">{$commentItem.firstname} {$commentItem.lastname}</a> 
			<span class="knCommentDate"> ({$commentItem.date|date_format:"%d.%m.%Y %H:%M"}) </span>
			<div>{$commentItem.text}</div>
		</div>
		<div style="clear: both"></div>
	</div>
	{/foreach}

	<div class="knMasterCommentForm">
		{if $loggedIn == false}
			<i>
				{$TEXT_COMMENT_FACEBOOK_LOGIN}
				&raquo; <a href="#" onclick="javascript:facebookOAuthLogin();">{$TEXT_LOGIN_WITH_FACEBOOK}</a>.
			</i>
		{else}
				<form action="/{$article.url}.html"
					method="post" id="commentForm">
					<textarea name="comment" id="comment"
						onclick="{literal}javascript:if(this.value=='{/literal}{$TEXT_WRITE_COMMENT}{literal}'){this.value='';this.style.color='#000000'}{/literal}"
						onblur="{literal}javascript:if(this.value==''){this.value='{/literal}{$TEXT_WRITE_COMMENT}{literal}';this.style.color='#999999'}{/literal}">{$TEXT_WRITE_COMMENT}</textarea>
		
					<input type="submit" class="knMasterCommentButton" value="{$TEXT_COMMENT}" />
				</form>
				<form action="/{$article.url}.html" method="post" id="deleteCommentForm">
					<input type="hidden" name="deleteComment" id="deleteComment" value="" />
				</form>
				
				<!-- jQuery UI delete comment dialog -->
				<div id="dialog-delete-comment" title="{$TEXT_DELETE_COMMENT}?" style="display:none;">
					<p>
						<span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;"></span>
						{$TEXT_REALLY_DELETE_COMMENT}
					</p>
				</div>
				<input type="hidden" id="textDeleteComment" value="{$TEXT_DELETE_COMMENT}" />
				<input type="hidden" id="textAbort" value="{$TEXT_ABORT}" />
				<div style="clear: both"></div>
		{/if}
	</div>
</div>